﻿/*
 * Created by SharpDevelop.
 * User: xieen
 * Date: 2013-08-23
 * Time: 15:33
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;

namespace GoF23Learning._16.Oberver_Pattern.Refactor
{
	/// <summary>
	/// Description of App.
	/// </summary>
	public class App
	{
		public void  OberverCall()
		{		
			BankAccount bankAccount = new BankAccount();			
			EmailOberver ee = new EmailOberver();
			bankAccount.AddOberver(ee);			
			bankAccount.Withdraw(5);
		  
		}		
		
		public void  EventCall()
		{		
			//事件
			BankAccountEvent bankAccount = new BankAccountEvent();			
			EmailEvent ee = new EmailEvent();
		  	bankAccount.AccountChanged += new AccountChangedHandler(ee.Send);
		}
	}
}
